﻿@model ProductDetailsModel.ProductPriceModel
@inject IWorkContext workContext
<div class="prices d-flex justify-content-center align-items-start row px-3 flex-column" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    @if (Model.CustomerEntersPrice)
    {
        @*display nothing*@
    }
    else if (Model.CallForPrice)
    {
        @*call for price*@
        <div class="product-price call-for-price col-12">
            <span>@T("Products.CallForPrice")</span>
        </div>
    }
    else
    {
        if (Model.IsReservation)
        {
            <div class="rental-price mb-3">
                <label class="mb-0">@T("Products.Price.ReservationPrice"):</label>
                <span>@Model.ReservationPrice</span>
            </div>
        }
        if (Model.IsAuction)
        {
            <div class="actual-price">
                @if (Model.HighestBidValue > 0)
                {
                    <label class="mb-0">@T("Products.Price.CurrentPrice"):</label>
                    <span>@Model.HighestBid</span>
                }
                else
                {
                    <label class="mb-0">@T("Products.Price.StartPrice"):</label>
                    <span>@Model.StartPrice</span>
                }
            </div>
        }
        if (!String.IsNullOrWhiteSpace(Model.CatalogPrice))
        {
            @*catalog price*@
            <div class="catalog-product-price col-12 mb-3">
                <label class="mb-0">@T("Products.Price.CatalogPrice"):</label>
                <span>@Model.CatalogPrice</span>
            </div>
        }
        if (!(Model.IsAuction && Model.DisableBuyButton))
        {
            <div class="@if (String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
        {<text>product-price col-12 d-inline-flex align-items-center</text>}
        else
        {<text>non-discounted-price col-12 d-flex align-items-center</text>}">
                @*render price*@
                <span class="price-value-@(Model.ProductId)">
                    @if (Model.IsAuction)
                    {
                        <strong class="actual-price">@T("Products.BuyNowPrice"):</strong>
                    }
                    @if (!String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                    {
                        <span class="actual-price">@Html.Raw(Model.Price)</span>
                    }
                    else
                    {
                        <strong class="actual-price">@Html.Raw(Model.Price)</strong>
                    }
                </span>
                @if (!String.IsNullOrWhiteSpace(Model.OldPrice))
                {
                    @*old price*@
                    <div class="old-product-price">
                        <span class="old-price ml-2">@Model.OldPrice</span>
                    </div>
                }

            </div>
        }
        else
        {
            @if (!String.IsNullOrWhiteSpace(Model.OldPrice))
            {
                @*old price*@
                <div class="old-product-price">
                    <span class="old-price ml-2">@Model.OldPrice</span>
                </div>
            }
        }

        if (!String.IsNullOrWhiteSpace(Model.PriceWithDiscount))
        {
            @*discounted price*@
            <div class="d-inline-flex align-items-center product-price discounted-price col-12">
                <label class="mb-0 mr-2">@T("Products.Price.WithDiscount"):</label>
                <span class="your-price price-value-@(Model.ProductId)">
                    <strong>@Html.Raw(Model.PriceWithDiscount)</strong>
                </span>
                 <meta itemprop="price" content="@Model.PriceValue.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)" class="your-price price-value-@(Model.ProductId)" />
            </div>
        }
        if (!String.IsNullOrEmpty(Model.BasePricePAngV))
        {
            <div class="base-price-pangv ml-2">
                @Model.BasePricePAngV
            </div>
        }
        if (Model.DisplayTaxShippingInfo)
        {
            var inclTax = workContext.TaxDisplayType == TaxDisplayType.IncludingTax;
            //tax info is already included in the price (incl/excl tax). that's why we display only shipping info here
            //of course, you can modify appropriate locales to include VAT info there
            <div class="tax-shipping-info generalMarginSupporter">
                @T(inclTax ? "Products.Price.TaxShipping.InclTax" : "Products.Price.TaxShipping.ExclTax", Url.RouteUrl("Topic", new { SeName = await Html.GetTopicSeName("shippinginfo", Context) }))
            </div>
        }
        if (!String.IsNullOrEmpty(Model.CurrencyCode))
        {
            <meta itemprop="priceCurrency" content="@Model.CurrencyCode" />
        }
        @if (String.IsNullOrWhiteSpace(Model.PriceWithDiscount)) {
            <meta itemprop="price" content="@Model.PriceValue.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)"/> 
        }
    }
</div>
